import java.util.Random;
import java.util.Scanner;

/**
 * Created by dllo on 18/3/30.
 */
public class Test04 {
    public static void main(String[] args) {

        Random random = new Random();//用来生成随机数,只写一次
        Scanner scanner = new Scanner(System.in);
        int target = random.nextInt(100);//随机生成的数字
        System.out.println("请输入一个0-100的数字"+target);
        int num = -1;
        do {
            System.out.println("用户给的一个数");
            num =scanner.nextInt();
            if (num>target){
                System.out.println("猜大了");
            }else if (num<target){
                System.out.println("猜小了");
            }
        }while(num!=target);
        System.out.println("猜对了");

    }
}
